import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

// console.log(store.state)
/* Layout */
export const constantRoutes = [
  // {
  //   path: '/',
  //   component: () => import('@/layout/index'),
  //   redirect: '/sys/home',
  //   show: true,
  //   meta: {
  //     id: 110000,
  //     show: true
  //   },
  //   children: [
  //     {
  //       path: '/sys/home',
  //       component: () => import('@/views/home/index'),
  //       meta: {
  //         title: '首页',
  //         icon: 'dashboard',
  //         id: 110001,
  //         show: true
  //       }
  //     }
  //   ]
  // },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  }
]
export const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  })

const router = createRouter()

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher
}

export default router
